//
//  EbookNetRequest.h
//  ebook
//
//  Created by 吴超飞 on 16/2/23.
//  Copyright © 2016年 Moton. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

//成功失败回调
typedef void(^RequestSuccessed) ( int stateCode , NSString *successMsg ,  NSDictionary *dict );
typedef void(^RequestFailed) ( int stateCode , NSString *failMsg );


@interface EbookNetRequest : NSObject

//解密解密的接口数据为字典
+(NSDictionary *)decryResponse:(id)response;
//获取设备类型
+(NSString *)getDeviceType;

/*
//GET 获取数据流并解密
+(void)dataTaskWithUrl:(NSString *)url success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//GET普通请求（未加密时调用）
+(void)getUrl:(NSString *)url success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock; */

+ (AFHTTPSessionManager *)httpManager;

+ (NSURLSessionDownloadTask *)downloadFileWithURLString:(NSString *)URLString
             downloadFileProgress:(void(^)(NSProgress *downloadProgress))downloadFileProgress
                       saveToPath:(NSString *)saveToPath
        downloadCompletionHandler:(void (^)(NSURL *filePath, NSError *error))downloadCompletionHandler;

//登录
+(void)loginWithName:(NSString *) userName passsword:(NSString *) password success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//注销
+(void)logoutSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//注册
+(void)registerWithName:(NSString *) userName passsword:(NSString *) password success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//绑定账号
+(void)blindCurentGuestWithName:(NSString *) userName passsword:(NSString *) password success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//游客登录
+(void)guestLoginWithName:(NSString *) udid success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;

//获取书架
+(void)bookcaseSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//书架推荐
+(void)recommendSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;

//添加书架
+(void)addBookcase:(NSString *) bookid success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//移除书架
+(void)removeBookcase:(NSString *) bookid success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//获取书城菜单
+(void)getStoreMenuSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//章节报错
+(void)submitError:(NSString *)bookid chapterId:(NSString *) chapterId type:(NSInteger )content success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//AF错误处理
+(void)failNSURLSessionDataTask:(NSURLSessionDataTask *)task error:(NSError *)error failedOperation:(RequestFailed)failedBlock;

//意见反馈
+(void)postFeedBackContent:(NSString *)content contact:(NSString *)contact Success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//字体列表下载
+(void)downloadFontListSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;

//换源
+(void)changeSources:(NSString *)bookid success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//解锁
+(void)unlock:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//检查更新
+(void)checkBookUpdate:(NSString *) bookid success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//app版本数据获取
+(void)applicationGetVersionDataSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//搜索联想
+(void)searchText:(NSString *)stext resultSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//根据bookid获取图书信息
+(void)getBook:(NSString *)bookid success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;

/*
//搜索  http://bapp.applex.top:8070/api/v1/store/booklist?unencry=1&page=1&sort=2&fullflag=1&subsort=0&sex=boy&order=visit
+ (void)getNativeStoreWithPage:(NSInteger)page sort:(NSInteger)sort fullflag:(NSInteger)fullflag order:(NSString *)order success:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
//搜索选项
+(void)getSeekOptionsSuccess:(RequestSuccessed)successBlock failed:(RequestFailed)failedBlock;
*/

//MD5加密
+(NSString *)MD5:(NSString *)str;
//获取签名
+(NSString *)getSign:(NSDictionary *)dict;
//广告id
+(NSString *)AD_UUID;
//获得设备型号
+(NSString *)getCurrentDeviceModel;

@end
